#include "../Logger.h"
#include "../TimeStamp.h"
#include <iostream>

int main()
{
    Logger::init("test_logger", "test_log.txt");
    Logger::setLevel(spdlog::level::debug);

    Logger::Debug("This is a debug message");
    Logger::Info("This is an info message");
    Logger::Warn("This is a warning message");
    Logger::Error("This is an error message");

    //格式化日志
    Logger::Info("Formatted message with number: {}", 42);
    Logger::Debug("Connection from {}:{}", "127.0.0.1", 8080);

    std::cout << std::endl;
    // 测试时间戳
    TimeStamp ts1 = TimeStamp::now();
    std::cout << "Current Time: " << ts1.toFormattedString() << std::endl;
    std::cout << "Microseconds: " << ts1.microSecondsSinceEpoch() << std::endl;

    TimeStamp ts2 = TimeStamp::now();
    std::cout << "Time diff: " << (ts2.microSecondsSinceEpoch() - ts1.microSecondsSinceEpoch())
              << " microseconds" << std::endl;
    std::cout << "\ntest_logger finished." << std::endl;
    return 0;
}
